extends Launcher
class_name ThrowNodeComponent

@export var throw_action:String = "throw"
@export var grab_component:GrabNode2DComponent
@export var throw_time:float = 1
var bullet:CarBullet

func _process(_delta: float) -> void:
	_check_throw()

func _check_throw():
	if !grab_component.grabed_node2d:
		return
	if Input.is_action_just_pressed("throw"):
		var dir = get_global_mouse_position() - gun.global_position
		bullet = fire(dir.normalized())
		bullet.get_in_car(grab_component.grabed_node2d,get_tree().current_scene)
		grab_component.place(bullet)
